package pers.cz.codegen.codegen;

/**
 * @program: jef-code-generator
 * @description: 抽象代码生成器
 * @author: Cheng Zhi
 * @create: 2022-08-05 17:04
 **/
public abstract class CodeGenerator {

    // 默认路径
    private String ipackage = "pers.cz.model";

    private String fileFolder = "jef-code-generator/src/test/java";

    public void setFileFolder(String fileFolder) {
            this.fileFolder = fileFolder;
    }

    public void setIpackage(String ipackage) {
        this.ipackage = ipackage;
    }

    public String getIpackage() {
        return ipackage;
    }

    public String getFileFolder() {
        return fileFolder;
    }

    /**
     * 代码生成，先生成之后再增强
     * @throws Exception
     */
    public void generateAndEnhance() throws Exception {
        generateCode();
        enhanceCode();
    }

    /**
     * 生成代码
     * @throws Exception
     */
    public abstract void generateCode() throws Exception;

    /**
     * 对生成的代码进行增强,可以针对生成的代码进行动态编译等操作
     * @throws Exception
     */
    public abstract void enhanceCode() throws Exception;
}
